Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename TypeSignature::NullAry --> TypeSignature::Nullary and improve comments #13817

Merged
merged 5 commits into from
Dec 19, 2024

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Dec 17, 2024

Which issue does this PR close?

Rationale for this change

Is the A here intended to be upper-case? I'd have expected Nullary

While I was making that change I noticed that the TypeSignature documentation could be improved as well so I did it at the same time

What changes are included in this PR?

  1. Rename TypeSignature::NullAry --> TypeSignature::Nullary
  2. improve comments

Are these changes tested?

By CI

Are there any user-facing changes?

The name of an enum has changed, but this has not yet been released, so it isn't a user visible change in my mind

datafusion/expr-common/src/signature.rs Show resolved Hide resolved
datafusion/expr-common/src/signature.rs Outdated Show resolved Hide resolved
datafusion/expr-common/src/signature.rs Outdated Show resolved Hide resolved
Coercible(Vec<TypeSignatureClass>),
/// The arguments will be coerced to a single type based on the comparison rules.
/// For example, i32 and i64 has coerced type Int64.
/// One or more arguments that can be "compared"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this mean ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs a follow-up

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed -- this can be made better. I will attempt a follow up

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

///
/// Note:
/// - If compares with numeric and string, numeric is preferred for numeric string cases. For example, nullif('2', 1) has coerced types Int64.
/// - If compares with numeric and string, numeric is preferred for numeric string cases. For example, `nullif('2', 1)` has coerced types `Int64`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the reader expected to know/assume that nullif uses signature "Comparable"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actual example direct reader to understand this easily

datafusion/expr-common/src/signature.rs Outdated Show resolved Hide resolved
datafusion/expr-common/src/signature.rs Show resolved Hide resolved
datafusion/expr-common/src/signature.rs Outdated Show resolved Hide resolved
datafusion/expr-common/src/signature.rs Outdated Show resolved Hide resolved
@jayzhan211
Copy link
Contributor

Thanks @alamb

Comment on lines +103 to +104
/// A function such as `concat` is `Variadic(vec![DataType::Utf8,
/// DataType::LargeUtf8])`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:
Maybe it would be more readable to go without DataType: for type names?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in #13840

@alamb
Copy link
Contributor Author

alamb commented Dec 19, 2024

Thank you for the reviews @jayzhan211 and @findepi -- I think this PR is an improvement over what is on main (though there is still more improvement to be had). Thus merging it in and will work on additional clarifications as a follow up

@alamb alamb merged commit 2439979 into apache:main Dec 19, 2024
25 checks passed
@alamb alamb deleted the alamb/nullary branch December 19, 2024 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
functions logical-expr Logical plan and expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants